Set View Options

Download (12k)

I recommended you view this page with Microsoft Internet Explorer 3, or Netscape Communicator 4, or later, to see the formatting which corresponds closely to AppleScript's default formatting.

The Finder in Mac OS 8 is much more flexible than previous versions, as you can now set options for each window that previously needed to be set globally from the Views control panel. The down side of this is that it's now much more work to set some of the options that could previously be set from this control panel. In particular if you want to set the snap-to-grid options, which columns are displayed or whether folder sizes are calculated in list views, you have to do it folder by folder.

Set View Options is a free droplet that can be used to automate this process, by setting the view options for each folder in turn, stepping through all sub-folders of folders dropped onto it. To do this it opens and changes the view of each folder it processes, as it's only possible to set the options for a view when it is active. For a large disk with hundreds of folders this can take a long time, but it's still a lot quicker and a lot less tedious than setting options by hand.

The droplet requires the Mac OS 8 Finder, and can't be easily edited with earlier versions of the Mac OS. It requires "Jon's Commands", a free collection of scripting additions by Jon Pugh, available from major Mac software archives and from http://www.infoworkshop.com/~jonpugh or http://cgi.scriptweb.com/osaxen/jons_commands.html. To install Jon's Commands just drop it onto the System Folder - with Mac OS 8 you no longer have install it in the Scripting Addtions folder yourself.

Configuration

To configure the droplet you need to edit the lines of the script that specify the options available, using the Script Editor application which is installed in the AppleScript folder inside your Apple Extras folder. The droplet is quite small so I've copied its script in full below. There are three sets of preferences you can edit, one for each of the list, button and icon views, and the appropriate sections of text have been highlighted in colours that match those used in this documentation.

In each section the first line changes ("set"s) the view so the preferences can be specified, while lines after it set the individual preferences. In the list view section the "calculate folder sizes" and "use relative dates" options are enabled, icons are set to their smallest size and the "show kind" option is disabled to remove that column from list views. The button view settings make buttons snap to a grid, while the icon view settings disables automatic alignment/arrangement options.

The complete list of options that can be specified is as follows:-
For list views:

        set use relative dates of theFolderWindow to true|false
        set calculate folder sizes of theFolderWindow to true|false
        set icon size of theFolderWindow to mini|small|large
        set show modification date of theFolderWindow to true|false
        set show creation date of theFolderWindow to true|false
        set show size of theFolderWindow to true|false
        set show kind of theFolderWindow to true|false
        set show label of theFolderWindow to true|false
        set show comments of theFolderWindow to true|false
        set show version of theFolderWindow to true|false
For button and icon views:
        set keep arranged of theFolderWindow to true|false
        set keep arranged by of theFolderWindow to grid|name|date modified|date created|size|kind|label|comment|version
        set icon size of theFolderWindow to small|large

Notes:

If you don't want to specify settings for a view, e.g. because you're not interested in the settings for button view, delete the block of text for that view, e.g. the green text for button views. This will make the droplet run faster and reduce the chance of side effects. Side effects can occur when you specify different arrangement options for button and icon views: e.g. if you specify arrangement "by name" for button views but disable keep arranged for icon views, icons will also be arranged by name as the rearrangement under button view will be remembered when the script changes to icon view.

Usage

I've increased the droplet's partition to 4000k as with a default partition size it would sometimes run out of memory. When processing very large numbers of folders I've seen the Finder run out of memory and quit, but this does not seem to be a serious problem as the droplet will just restart the Finder and continue where it left off. The droplet runs quickest if the Finder is brought to the front while it is running. You shouldn't move, rename or make other changes to folders while it is running as it may then miss folders and their sub-folders. You should be able to work with files and use other applications while it is running in the background.

In theory you should be able to drop entire disks on it to process all the folders on the disk, but when I've tried this it halts with an error when it reaches the Trash. Instead open the disk window and drop all of the folders on the disk onto the droplet. You should test it on a few small folders first, to make sure it does what you expect and to get an idea of how long it takes, before letting it work on the rest of your hard disk(s).

Other Resources

Since the release of Mac OS 8 two other resources have been released to do a similar task to Set View Options. The first is also an AppleScript script, one of a free collection of scripts for Mac OS 8 from Apple, AppleScript Utility Scripts Collection, available from Apple's excellent AppleScript Site. The second is Window Tamer, a shareware control panel/background application which lets you copy the view settings from one window to another.

Revisions

© 1997 John Blackburne. Distributed as freeware: may be redistributed without restriction as long as this documentation is included and no money is chaged for it. Please contact me for commercial distribution.


on open (theItems)
    script viewOptionsSetter
        on open (theFolder)
            tell application "Finder"
                set theFolderWindow to container window of theFolder
                try -- this will skip over non-folder windows, e.g. desktop printers
                    open theFolderWindow
                    set savedView to view of theFolderWindow
                    set view of theFolderWindow to name -- i.e. list view
                    --- start setting list view global prefs ---
                    set calculate folder sizes of theFolderWindow to true
                    set use relative dates of theFolderWindow to true
                    set show kind of theFolderWindow to false
                    set icon size of theFolderWindow to mini
                    --- end setting list view global prefs ---
                    set view of theFolderWindow to small button
                    --- start setting button view global prefs ---
                    set keep arranged of theFolderWindow to true
                    set keep arranged by of theFolderWindow to grid
                    --- end setting button view global prefs ---
                    set view of theFolderWindow to icon
                    --- start setting icon view global prefs ---
                    set keep arranged of theFolderWindow to false
                    --- end setting icon view global prefs ---
                    set view of theFolderWindow to savedView
                    close theFolderWindow
                on error
                    beep
                end try
            end tell
        end open
    end script
    walk folders theItems with script viewOptionsSetter with using folders without using files
end open

© John Blackburne, johnb@hk.super.net, 18th August 1997


up to John's Home Page